# -*- coding: utf-8 -*-

from PyQt4.QtGui import QDialog
from PyQt4.QtCore import SIGNAL
from PyQt4.Qt import QRect, QDesktopWidget
from PyQt4.QtCore import QCoreApplication, QEventLoop
from ui_prestrepo import Ui_PrestRepo
from subprocess import *

class PrestRepo(QDialog):
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.ui = Ui_PrestRepo()
        self.ui.setupUi(self)
        self.browser = None

        available_geom = QDesktopWidget().availableGeometry()
        current_geom = self.frameGeometry()
        self.setGeometry(available_geom.width() / 2 - current_geom.width() / 2, available_geom.height() / 2 - current_geom.height() / 2, current_geom.width(), current_geom.height())

        self.connect(self.ui.prestRepoOkBtn, SIGNAL("clicked()"), self.setPrestRepo)
        self.connect(self.ui.prestRepoCancelBtn, SIGNAL("clicked()"), self.resetPrestRepo)

    def setPrestRepo(self):        
        self.hide()

    def resetPrestRepo(self):
        self.hide()     

    def prestRepoPath(self):
        return self.ui.prestRepoPath.text()
